package com.contractpage.ec.service.impl;


import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.contractpage.common.persistence.Page;
import com.contractpage.ec.dao.AppointDao;
import com.contractpage.ec.service.AppointService;
import com.contractpage.ec.entity.Appoint;
import com.contractpage.ec.entity.ContractDetail;



/**
 * 
 * AppointServiceImpl数据库操作接口类
 * 
 **/
@Transactional
@Service
public class AppointServiceImpl implements AppointService{
	@Autowired
	private AppointDao appointDao;
	@Override
	public Page<Appoint> findList(Page<Appoint> page,Appoint entity){
		entity.setPage(page);
		page.setList(appointDao.findList(entity));
		return page;
	}
	@Override
	public int insert(Appoint entity){
		entity.preInsert("");
		return appointDao.insert(entity);
	}
	@Override
	public int update(Appoint entity){
		entity.preUpdate();
		return appointDao.update(entity);
	}
	@Override
	public int delete(Appoint entity){
		 return appointDao.delete(entity);
	}
	@Override
	public List<Appoint> find(Appoint entity) {
		// TODO Auto-generated method stub
		return appointDao.findList(entity);
	}
	@Override
	public Integer findCount(Appoint entity) {
		return appointDao.findCount(entity);
	}
	@Override
	public Appoint get(Appoint entity) {
		// TODO Auto-generated method stub
		return null;
	}
	@Override
	public Integer insertBatch(ContractDetail detail) {
		// TODO Auto-generated method stub
		for(Appoint appoint : detail.getApps()){
			appoint.preInsert();
		}
		return appointDao.insertBatch(detail);
	}
	@Override
	public List<Appoint> findAllList(Appoint entity) {
		return appointDao.findList(entity);
	}
	@Override
	public List<Appoint> findAllListGroupProject(Appoint entity) {
		// TODO Auto-generated method stub
		return appointDao.findAllListGroupProject(entity);
	}
}